#include <iostream>
#include <signal.h>
#include <unistd.h>
using namespace std;

void handler(int signo)
{
    cout << "get a signo : " << signo << endl;
}

int main()
{
    struct sigaction act, oact;
    act.sa_handler = handler;
    sigaction(2, &act, &act); //对2号信号进行自定义捕捉
    while(true)
    {
        sleep(1);
    }
    return 0;
} 